import {rq} from "./axios.ts";
import {Blog} from "@/types";

export const blog_get_api = () => rq.get("/blog-info")
export const blog_one_api = (id: number) => rq.get(`/blog-info/${id}`)
export const blog_post_api = (blog: Blog) => rq.post('/blog-info', blog)
export const blog_put_api = (blog: Blog) => rq.put('/blog-info', blog)
export const blog_del_api = (id: number) => rq.del(`/blog-info/${id}`)
export const blog_comment_get_api = (state?: number) => rq.get("/blog-comment", {state})
export const blog_category_get_api = () => rq.get("/blog-category")
export const blog_category_post_api = (data: { name: string, parent_id: number }) => rq.post("/blog-category", data)
export const blog_category_put_api = (data: { name: string, id: number }) => rq.put("/blog-category", data)
export const blog_category_del_api = (id: number) => rq.del(`/blog-category/${id}`)
export const login_api = (data: { username: string, password: string }) => rq.post("/login", data)